<title><?=$v['title']?></title>
<link rel="stylesheet" type="text/css" href="css/page.css"/>
<link rel="stylesheet" type="text/css" href="http://www.12301.cc/css/common/www.12301.cc.global.css"/>
<link rel="stylesheet" href="css/print.css" media="print" />
<script src="http://www.12301.cc/js/ui/PopWindow.js" type="text/javascript"></script>
<script src="http://www.12301.cc/js/Calendar.js" type="text/javascript"></script>
<script language="javascript" src="http://www.12301.cc/js/jquery_PrintArea.js"></script>
<style>
.refundsead{ margin:10px 0; padding:20px; color:#000; border:1px solid #ccc;}
.refundsead span{ margin-right:20px;}
.refundsead .time{ width:100px; border:1px solid #7F9DB9; height:18px; background:url("images/rili.png") no-repeat right center #FFFFFF;}
.refundsead .inptxt{ height:18px; line-height:18px; border:1px solid #7F9DB9; margin-right:30px;}
.refundsead .inpsub{cursor:pointer; background:url(../images/search.png) no-repeat left top;border:none;width:85px;height:30px;}
.refundsead .inpsub:hover{ background-position:left bottom;}
.refund-tab { width:100%; line-height:18px;table-layout:fixed;}
.refund-tab th{ background:#F3F3F3; border:1px solid #DEDEE0; height:30px; text-align:center;}
.refund-tab td{ border:1px solid #DEDEE0; text-align:center; padding:5px 0;line-height: 26px;}
.refund-tab .txt-left { text-align:left; padding-left:15px; }
.refund-tab tbody .whiat td{ height:0px; border:0;}
.refund-tab tbody .wodtab td{background:#F3F3F3; border:1px solid #DEDEE0;line-height:30px; text-align:left; padding:0 15px;}
body a.bank-account{font-weight: 700;font-size: 14px;color:#008000;}
.money {font-weight: 700;}
.money-last{font-size: 14px;color:#ff6600;}
.refund-tab tbody .wodtab td span{ margin-right:20px;}
.refund-tab tbody .wodtab td span.wid200{ width:200px; margin-right:0; display:inline-block;}
#FenID{margin:10px 0}
#FormLeft{float:left}
#FormRight{float:right;margin-top:10px;}
.refundsead div{height: 50px;}
#PopWindow{ padding:20px; border:4px solid #bbb}
#PopWindow textarea{width:200px;}
#PopWindow .btn{ width:100px; height:25px; font-size:12px; cursor:pointer}
.td-medium{ width: 320px;}
.td-small{width: 230px;}
p.p_top{border-bottom:1px solid #D4E7FF;}
p .again{display:inline-block;width:180px;}
p .people{display:inline-block;}
p.re{position:relative;}
.print_t{cursor:pointer;}
#box_frm{width:400px;height:220px;margin:0 auto;}
#box_frm .sub_b{text-align: center;margin-top: 20px;}
#box_frm #input_txt{width:320px;height:120px;padding:10px;resize: none;border:1px solid #rgba(127, 124, 134, 0.4);}
.btn_submit{width: 100px;height: 30px;margin-right: 10px;
line-height: 30px;border: 0;font-size: 1.4em;background-color: #00a0e9;text-align: center;font-weight: normal;
color: #FFF;cursor: pointer;}
/*遮罩*/
#Mask_div{z-index:1000;background-color:gray; opacity:0.5; position:absolute; top:0; z-index:9000; filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5; } 
#pop_refund{ background-color:#fff;border:5px solid rgba(127, 124, 134, 0.4);  height:270px; left:50%; margin:-200px 0 0 -200px; padding:1px; position:fixed !important; /* 浮动对话框 */ 
position:absolute; top:55%; width:400px; z-index:9999; border-radius:5px; display:none;text-align:center;  } 
.no_unline a{text-decoration:none;}
.no_unline a:hover{text-decoration:none;}
.refund_title{height:60px;line-height:60px;font-size:16px;text-align:left;margin-left:30px;}
.delrefun{font-size:14px}
</style>
<div class="r_content">
	<h3 class="mc_title">
        <span class="mctit_1"><span class="mctit_2">提现申请列表</span></span>
    </h3>

	<form class="refundsead">
    <div>
        <div id='FormLeft'>
            <input type="hidden" id="act" name="act" />
            <span>
                <label>查询时间：</label>
                <select name="time">
                    <option value="apply_time">申请时间</option>
                    <option value="wd_time">处理时间</option>
                </select>
                <input type="text" class="time" onmouseup="SelectDate(this,'yyyy-MM-dd',0,0)" name="btime" value="<?=$_REQUEST['btime']?>"/>
                <label>至</label>
                <input type="text" class="time" onmouseup="SelectDate(this,'yyyy-MM-dd',0,0)" name="etime" value="<?=$_REQUEST['etime']?>"/>
            </span>
            <div id='FenID'>
                <label>分销商名称：</label>
                <input type="text" class="inptxt" name="dname" value="<?=$dname?>"/>
                <label>分销商ID：</label>
                <input type="text" class="inptxt" name="mid" value="<?=$mid?>"/>
            </div>
        </div>
        <div id='FormRight'>
            <input type="submit" class="inpsub" value=""/>
            <a href="javascript:void(0);" id="excel">导出</a>
        </div>
        </div>
	</form>
	<table class="refund-tab" id="print_id">
        <thead>
        <tr>
            <th class="td-medium">账户</th>
            <th class="td-small">金额</th>
            <th>操作</th>
        </tr>
        </thead>
		<?php foreach($r as $row):?> 
        <? $colspan = $row['wd_status']==1 ? 2 : 1; ?>
		<tbody class="print_table" id="myPrintArea" >
			<!--startprint--> 
        	<tr class="whiat"><td colspan="3"></td></tr>
            <tr class="wodtab wodtab_print">
            	<td colspan="3">
                    <span><?=$wd_statusT[$row['wd_status']]?></span>
                    <span class="wid350">[<?=$row['fid']?>]-<?=$row['dname']?></span>
                    <span>申请时间：<?=$row['apply_time']?></span>
                    <span>完成时间：<?=$row['wd_time']?></span>
                </td>
            </tr>
            <tr class="user">
                <td class="txt-left td-medium">
                    <p class="name_print">收款账户(户名)：</p>
                    <p class="bank_print"><?=$row['bank_name']?></p>
                    <p class="re">
                        <a  class="bank-account clipLinkBtn_copy copy" title="点我复制" data-link="<?=$row['bank_accuont']?>">
                            <?=$row['bank_accuont']?>
						</a>&nbsp;&nbsp;&nbsp;<?=$row['wd_name']?>
                    </p>
                </td>
                <td class="txt-left user_print">
                    <p class="hhhhh">申请提现金额：<span class="money">&yen;<?=$row['wd_money']/100?></span></p>
                    <p>手续费：<span class="money">&yen;<?=$row['tfee']?></span></p>
                    <p>应转账金额：<span class="money money-last">&yen;<?=$row['wd_money']/100-$row['tfee']?></span></p>
                </td>
				<?php if($row['wd_status']==0):?>
                <td style="width: 50px;" class="no_unline">
                    <?php if(!$disable_ctr):?>
                    <!--禁止操作-->
                    <p>
                        <a class="refund-handler"
                           href="javascript:;"
                          data-applyid="<?=$row['id']?>"
                          data-status="<?=$status_ok?>"
                          data-oldstatus="<?=$row['wd_status']?>"><i class="iconfont">&#xe63c;</i>&nbsp;<?=$btn_ok?></a>
                    </p>
                    <p>
                        <a href="javascript:;"
                           class="refund-handler"
                           data-applyid="<?=$row['id']?>"
                           data-status="<?=$status_deny?>"
                           data-oldstatus="<?=$row['wd_status']?>"><i class="iconfont">&#xe64b;</i>&nbsp;<?=$btn_deny?></a>
                     </p>
                    <p class="print_t"><a><i class="iconfont">&#xe64f;</i>&nbsp;打印</a></p>
                    <?php endif;?>
                </td>
				<?php else:?>
				<td style="width: 50px;" colspan="1" rowspan="1" class="no_unline">
					<table style="width: 180px;border:1px;">
						<tr>
						   <p class="p_top">
								<span class="again"><?=$row['memo']?></span>
								<span class="people">处理人:<?=$row['wd_operator']?></span>
							</p>
						</tr>
						<tr>
						    <p>
                                <a class="refund-handler"
                                   href="javascript:;"
                                   data-applyid="<?=$row['id']?>"
                                   data-status="<?=$status_ok?>"
                                   data-oldstatus="<?=$row['wd_status']?>"><i class="iconfont">&#xe64d;</i>&nbsp;<?=$btn_ok?></a>
                                <a href="javascript:;"
                                   class="refund-handler"
                                   data-applyid="<?=$row['id']?>"
                                   data-status="<?=$status_deny?>"
                                   data-oldstatus="<?=$row['wd_status']?>"><i class="iconfont">&#xe64e;</i>&nbsp;<?=$btn_deny?></a>
								<a class="print_t"><i class="iconfont">&#xe64f;</i>&nbsp;打印</a>
							 </p>
						</tr>
					</table> 
                   
                </td>
				<?php endif;?>

                <!--<td>
                    <p>操作员：</p>
                    <p><?=$row['wd_operator']?></p>
                    <p>备注：</p>
                    <p><?=$row['memo']?></p>
                </td>-->
            </tr>
			<!--endprint--> 
        </tbody>
		<?php endforeach;?>
	</table>
	<div class="bot"><?if($total)page($total,$currentPage,$pageSize);?></div>
</div>
<div id="pop_refund">
	<form id="box_frm">
		<h3 id="title_msg" class="refund_title"></h3>
		<p><textarea id="input_txt" name="other"></textarea></p>
        <!-- <p><input id="input_txt" type="text"/></p> -->
		<div class="sub_b">
			<input type="button" value="提 交" class="btn btn_submit"/>
			<a href="#"  class="btn delrefund" onclick="closeBg();"/>取消</a>
		</div>
	</form>
</div>
<script>
var popBox=new PopWindow();
var action_url = 'http://www.12301.cc/module/withdraw/handler.php';
$("a.btn-deny").click(function(){
	var applyid=$(this).attr("applyid");
	$("#applyid").val(applyid);
	$("#pop_tpl #id").val($(this).data("applyid"));
	popBox.open($("#pop_tpl").html())
	$("#PopWindow .submit").click(function(){
		$.ajax({
			"url":action_url,
			"dataType":"json",
            "method":"post",
			"data":$("#PopWindow form").serialize(),
			"success":function(data){
				if(data.outcome==1){
					alert("操作成功");
				} else {
					alert("操作失败:"+data.msg);
				}
				window.location=window.location.href;
			}
		});
		return false;
	});
	return false;
});

var post = function (params){
    $.ajax({
		"url":action_url,
        "dataType":"json",
        'type':'post',
        "data": params,
        "success": function(data){
            if(data.outcome==1){
                alert("操作成功");
				closeBg();
            }else{
                alert("操作失败:"+data.msg);
            }
//            window.location=window.location.href;
        }
    });
};
// $(".refund-handler").click(function(){
    // var applyid= $(this).data("applyid"),
        // status = $(this).data('status'),
        // msg_obj = {
            // "0":"请填写退回申请原因",
            // "2":"请填写支付宝交易号或银行业务参考号"
        // },
        // box_content = '';
    // var params = {
        // action:'refund',
        // refund_status:status,
        // id:applyid
    // };
	// $("#applyid_refund").val(applyid);
	// $("input[name=refund_status]").val(status);

    // if (status==1) {
        // //客服审核通过,不需要记录其他的东西
        // if (!confirm('确定要同意提现吗？')) return false;
        // post(params);
        // return false;
    // }
    // $("#title_msg").text(msg_obj[status]);
    // box_content = $("#pop_refund").html();
    // popBox.open(box_content);
	// $(".btn_submit").on('click', function(){
		// console.log($("form#box_frm").serialize());
		// //var input_txt = $(this).("#input_txt")val();
		// var input_txt = $("input[name='other']").val()
		 // alert(input_txt);
		// // console.log(input_txt);
		// if (!input_txt || input_txt.length==0) {
			// alert(msg_obj[status]);
		 // }
		 // params['input_txt'] = input_txt;
		// post(params);
	// });
// });

$("#excel").click(function(){
	$("#act").val("Export");
	$("form.refundsead").submit();
	$("#act").val("");
});

/*新的拒绝*/
$("#print_id").on('click', '.refund-handler', function(e){
	var target = $(e.currentTarget);
	var applyid= target.data("applyid"),
    status = target.data('status'),
    msg_obj = {
        "0":"请填写退回申请原因",
        "2":"请填写支付宝交易号或银行业务参考号",
        "4":"请填写退回申请原因"
    };
	var params = {
         action:'refund',
         refund_status:status,
         id:applyid
     },	elem = $(this);
	if (status==1) {
        //客服审核通过,不需要记录其他的东西
        if (!confirm('确定要同意提现吗？')) return false;
        post(params);
         return false;
    }
	$("#title_msg").text(msg_obj[status]);
	var bh = $("html").height(); 
	var bw = $("html").width();  
	$("#mask").css({ height:bh, width:bw, display:"block" });
	$("#pop_refund").show(); 
	
	$("#pop_refund").on('click', '.btn_submit', function(){
	var input_txt = $("#input_txt").attr("value");
	var parama = {
         action:'refund',
         refund_status:status,
         id:applyid,
		 input_txt:input_txt
     },	elem = $(this);
    $.ajax({
        "url":action_url,
        "dataType":"json",
        'type':'post',
        "data":parama,
        "success": function(data){
             if(data.outcome==1){
                 alert("操作成功");
				 closeBg();
				 location.reload();
            }else{
                 alert("操作失败:"+data.msg);
				 location.reload();
             }
// //  window.location=window.location.href;
         }
     });
});
});	

/*关闭弹窗*/
function closeBg() { 
    $("#mask,#pop_refund").hide(); 
} 

/*复制银行账号*/
$(function(){
	$(".clipLinkBtn_copy").zclip({
		path: "http://www.12301.cc/wx_public/zclip/ZeroClipboard.swf",
		copy: function(){
			return $(this).attr("data-link");
		},
		deforeCopy : function(){},
		afterCopy : function(){
		   alert("已复制到剪贴板")
		}
	});
}); 
/*打印*/
$("#print_id").on('click', '.print_t', function(e){
		var target= $(e.currentTarget);
		target.parents(".print_table").printArea(); 
});

</script>